public class TestDemo {

    public static ListNode add1_1(){
        ListNode node1 = new ListNode(1);
        ListNode node2 = new ListNode(3);
        ListNode node3 = new ListNode(5);
        ListNode node4 = new ListNode(6);
        ListNode node5 = new ListNode(6);
        ListNode node6 = new ListNode(7);
        ListNode node7 = new ListNode(9);
        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        node5.next = node6;
        node6.next = node7;
        return node1;
    }
    public static ListNode add1_2(){
        ListNode node1 = new ListNode(0);
        ListNode node2 = new ListNode(9);
        ListNode node3 = new ListNode(12);
        node1.next = node2;
        node2.next = node3;
        ListNode head = node1;
        return node1;
    }

    public static ListNode add2(){
        ListNode node1 = new ListNode(9);
        ListNode node2 = new ListNode(0);
        ListNode node3 = new ListNode(2);
        node1.next = node2;
        node2.next = node3;
        return node1;
    }

    public static ListNode add3(){
        ListNode node1 = new ListNode(2);
        ListNode node2 = new ListNode(3);
        ListNode node3 = new ListNode(4);
        ListNode node4 = new ListNode(7);
        ListNode node5 = new ListNode(8);
        ListNode node6 = new ListNode(0);
        ListNode node7 = new ListNode(2);
        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        node5.next = node6;
        node6.next = node7;
        return node1;
    }

    public static void main(String[] args) {
//        ListNode node1 = add1_1();
//        ListNode node2 = add1_2();
//        exercise01 e1 = new exercise01();
//        ListNode node3 = e1.addTwoNumbers(node1,node2);
//
//        exercise02 e2_ = new exercise02();
//        ListNode node2_ = add2();
//        ListNode node2_2 = e2_.removeNthFromEnd(node2_,3);
//        while (node2_2 != null){
//            System.out.print(node2_2.val + " ");
//            node2_2 = node2_2.next;
//        }

        //ListNode node3_1 = add3();
//        ListNode node3_1 = null;
//        exercise03 e3 = new exercise03();
//        ListNode node3_3 = e3.swapPairs(node3_1);
//        while (node3_3 != null){
//            System.out.print(node3_3.val + " ");
//            node3_3 = node3_3.next;
//        }

        exercise04 e4 = new exercise04();
//        ListNode node4_1 = null;
        ListNode node4_2 = null;
        ListNode node4_1 = add1_1();
//        ListNode node4_2 = add1_2();
        ListNode[] lists = {node4_1,node4_2};
        ListNode node4_3 = e4.mergeKLists(lists);
        while (node4_3 != null){
            System.out.print(node4_3.val + " ");
            node4_3 = node4_3.next;
        }
    }
}
